package cn.adolf.carmaster.helper;

import android.content.Context;
import android.content.SharedPreferences;

import cn.adolf.carmaster.App;

public class ShareManager {
    public static volatile ShareManager instance;
    private final SharedPreferences mSp;

    private ShareManager() {
        mSp = App.getContext().getSharedPreferences("config", Context.MODE_PRIVATE);
    }

    public static ShareManager getInstance() {
        if (instance == null) {
            synchronized (ShareManager.class) {
                if (instance == null) {
                    instance = new ShareManager();
                }
            }
        }

        return instance;
    }

    public void saveIp(String str) {
        mSp.edit().putString("Ip", str).apply();

    }

    public String getIp() {
        return mSp.getString("Ip", "192.168.1.1");
    }

    public void savePort(String str) {
        mSp.edit().putString("Port", str).apply();

    }

    public String getPost() {
        return mSp.getString("Port", "5555");
    }


}
